<%--
  Created by IntelliJ IDEA.
  User: YanHilin
  Date: 2020/4/20
  Time: 12:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>用户注册</title>
    <base href="http://localhost:8080/onlineflower/">
    <link rel="stylesheet" type="text/css" href="static/css/form.css">
    <%@include file="/page/comment/head.jsp"%>
    <script src="static/js/jquery-3.4.1.js"></script>
    <%@include file="/page/comment/code_img.jsp"%>
</head>
<body>
<%@include file="/page/comment/head_nav.jsp"%>
<div id="content">
    <form action="userServlet" method="post">
        <input type="hidden" name="action" value="register">
        <div class="form-group">
            <label class="glyphicon glyphicon-user">编号</label>  <span id="errormesg">${sessionScope.mess}</span>
            <input id="userid" class="form-control input-lg"  type="text" name="userid" placeholder="请输入编号">
        </div>
        <div class="form-group">
            <svg class="bi bi-people-circle" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                <path d="M13.468 12.37C12.758 11.226 11.195 10 8 10s-4.757 1.225-5.468 2.37A6.987 6.987 0 0 0 8 15a6.987 6.987 0 0 0 5.468-2.63z"/>
                <path fill-rule="evenodd" d="M8 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" clip-rule="evenodd"/>
                <path fill-rule="evenodd" d="M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1zM0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8z" clip-rule="evenodd"/>
            </svg>  <label for="exampleInputEmail2">relname</label>
            <input type="text" name="relname" class="form-control input-lg" id="exampleInputEmail2" placeholder="relname">
        </div>

        <div class="form-group">
            <span class="glyphicon glyphicon-earphone"></span>  <label for="exampleInputEmail3">telephone</label>
            <input type="text" name="telephone" class="form-control input-lg" id="exampleInputEmail3" placeholder="telephone">
        </div>
        <div class="form-group">
            <label class="glyphicon glyphicon-edit">密码</label>
            <input type="password"  class="form-control input-lg" name="password" placeholder="请输入密码">
        </div>
        <div class="form-group">
            <label class="glyphicon glyphicon-edit">再次输入密码</label>
            <input type="password" class="form-control input-lg" name="again_password" placeholder="请再次输入密码">
        </div>
        <div class="form-group">
            <label class="glyphicon glyphicon-check">验证码</label>
            <div class="row">
                <div class="col-7">
                    <input id="input_code" type="text" class="form-control input-lg" name="code" placeholder="请输入验证码">
                </div>
                <div class="col-5">
                    <img id="code_img" src="KaptchaServlet.jpg" alt="">
                </div>
            </div>
        </div>
        <button type="submit" class="btn btn-secondary btn-lg btn-block">register</button>
    </form>
</div>
</body>

<script>
    $(function () {
        $("#userid").blur(function () {
            var userid=this.value;
            $.getJSON("http://localhost:8080/onlineflower/userServlet","action=ajaxExistsUserid&userid="+userid,function (data) {
                if(data.existsUserid){
                    $("#errormesg").text("用户id"+userid+"已经存在！");
                }else{
                    $("#errormesg").text("用户id"+userid+"可用！");
                }
            });
        });
    })
</script>
</html>
